import service from "@/utils/request";
import type { CategoryList, AttrArr,Attr } from "./interface";
//属性管理模块请求地址
enum API {
    C1 = "/admin/product/getCategory1",
    C2 = "/admin/product/getCategory2/",
    C3 = "/admin/product/getCategory3/",
    ATTR = "/admin/product/attrInfoList/",
    // 更新，添加属性
    ADDORATEATTR= '/admin/product/saveAttrInfo',
    DELETEATTR = '/admin/product/deleteAttr/'
}
//获取一级分类的接口
export const reqC1 = () => service.get<any, CategoryList>(API.C1);
//获取二级分类的接口
export const reqC2 = (category1Id: number) => service.get<any, CategoryList>(API.C2 + category1Id);
//获取三级分类的接口
export const reqC3 = (category2Id: number) => service.get<any, CategoryList>(API.C3 + category2Id);
//获取某一个三级分类下全部属性与属性值
export const reqAttrList = (c1: number, c2: number, c3: number) => service.get<any, AttrArr>(API.ATTR + `${c1}/${c2}/${c3}`);
// 更新，添加属性
export const reqAddOrUpdateAttr = (data:Attr) => service.post<any,any>(API.ADDORATEATTR,data);
// 删除
export const reqDeleteAttr = (attrId:number) => service.delete<any,any>(API.DELETEATTR+attrId) 



